import Vue from 'vue'

// base library
import {
    ConfigProvider,
    Input, InputNumber, Button, Switch, Radio, Checkbox, Select, Form, AutoComplete,
    Layout, Row, Card, Col, Tabs, Breadcrumb, PageHeader,
    Modal, Alert, Tooltip, Popover, notification, message, Badge, Popconfirm,
    Table, Descriptions, List,
    Icon,
    Dropdown, Menu,
    Avatar,
    Steps,
    Spin,
    Drawer,
    Tag,
    Divider,
    DatePicker,
    TimePicker,
    Upload,
    Progress,
    Skeleton,
    Result,
    Statistic,
    Cascader,
} from 'ant-design-vue'

// ext library
import Viser from 'viser-vue'
import VueCropper from 'vue-cropper'
import { PageHeaderWrapper } from "@ant-design-vue/pro-layout"
import { Dialog } from '@/components'

//页面操作按钮权限
import ActionPermission from '@/permission/action'
import '@/directives/action'
import apis from '@/apis'
import config from "@/config";
import MultiTab from '@/components/MultiTab'
import PageLoading from '@/components/PageLoading'

const components = [
    ConfigProvider, Layout, Row, Col, Tabs, PageHeader,
    Input, InputNumber, Button, Switch, Radio, Checkbox, Select, Card, Form, DatePicker, TimePicker, Upload,
    Modal, Tooltip, Alert, Badge, Dialog, Popconfirm, Popover,
    Table, List, Tag, Descriptions, Statistic,
    Icon,
    Dropdown, Menu,
    Avatar, Breadcrumb,
    Steps,
    Spin,
    Drawer,
    Divider,
    Progress,
    Skeleton,
    Result,
    Viser,
    ActionPermission,
    VueCropper,
    Cascader,
    AutoComplete,
    MultiTab,
    PageLoading,
];



//设置组件默认属性
Card.props.bordered.default = false
Modal.props.destroyOnClose.default = true
// Modal.props.keyboard.default = false
// Modal.props.maskClosable.default = false
Table.props.bordered.default = true
Table.props.rowKey.default = "id"
// children 只能为数组类型(没有子节点时需要在序列化时去掉该字段)
Cascader.props.fieldNames.default = () => {
    return {
        label: 'label',
        value: 'value',
        children: 'children'
    }
}
Input.props.allowClear.default = true
Select.props.allowClear.default = true


//注册组件
Vue.component('page-header-wrapper', PageHeaderWrapper)
components.map(component => {
    Vue.use(component)
});

Vue.prototype.$message = message
Vue.prototype.$notification = notification
Vue.prototype.$confirm = Modal.confirm
Vue.prototype.$apis = apis
Vue.prototype.$Conf = config